<template>
  <div class="data_input">
    <!-- 省市区级联选择器 -->
    <div class="pca">
      <el-cascader-panel
        v-model="form.pca"
        :props="{label:'name',value:'name'}"
        :options="pca"
      />
    </div>
    <!-- 表单 -->
    <div class="form">
      <el-row>
        <el-col :span="12">
          <el-form label-width="80px" size="small">
            <el-form-item label="确诊">
              <el-input v-model="form.confirmed" />
            </el-form-item>
            <el-form-item label="疑似">
              <el-input v-model="form.suspected" />
            </el-form-item>
            <el-form-item label="死亡">
              <el-input v-model="form.dead" />
            </el-form-item>
            <el-form-item label="治愈">
              <el-input v-model="form.cure" />
            </el-form-item>
            <el-form-item label="重症">
              <el-input v-model="form.severe" />
            </el-form-item>
            <el-form-item label="境外输入">
              <el-input v-model="form.outside" />
            </el-form-item>
            <el-form-item>
              <el-button size="small" type="primary" @click="submit"> 提交 </el-button>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
    </div>
    <!-- {{form}} -->
  </div>
</template>

<script>
import pca from '@/assets/pca.json' 
import { get, post } from '@/utils/request'
import moment from 'moment'
export default {
  data() {
    return {
      pca,
      form: {
        country: '中国'
      }
    }
  },

  methods: {
    submit() {
      // 将form数据进行克隆
      const data = Object.assign({}, this.form)
      data.province = this.form.pca[0]
      data.city = this.form.pca[1]
      data.area = this.form.pca[2]

      // 交互
      let url = 'http://47.110.140.218:8001/epidemic/saveOrUpdate'
      post(url, data).then(response => {
        this.$message({ type: 'success', message: response.message })
      })
    },


  }
}
</script>

<style scoped>

</style>
